package com.ruoyi.job.task;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.weChatRobot.utils.WechatRobotUtil;
import com.ruoyi.employment.api.RemoteEmploymentService;
import com.ruoyi.employment.api.domain.TeacherToEmploymentDto;
import com.ruoyi.student.api.RemoteStudentService;
import com.ruoyi.student.api.domain.SysStudent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.stream.Collectors;

@Component("employmentServiceTask")
public class RyEmploymentTask {

    @Autowired
    private RemoteStudentService remoteStudentService;
    @Autowired
    private RemoteEmploymentService remoteEmploymentService;

    /**
     * 每天早上9.00执行一次
     */
    public void ryEmploymentTaskSend() {
        List<TeacherToEmploymentDto> allTrack = remoteEmploymentService.getAllTrack();
        List<String> studentNames = allTrack.stream()
                .map(TeacherToEmploymentDto::getStudentName)
                .collect(Collectors.toList());
        //为就业的学
        String message = "请未就业的学员:"+studentNames+"去就业";
        WechatRobotUtil.sendTextMessage(message, new ArrayList());

    }

    /**
     * 7天执行一次，查询所有未就业并且没有追踪记录的学生
     */
    public void ryEmploymentTaskSend2() {
        List<SysStudent> studentList = remoteStudentService.getStudentList();
        List<String> StudentNames = studentList.stream().map(SysStudent::getStudentName).collect(Collectors.toList());
        //查询追踪表数据
        List<TeacherToEmploymentDto> allTrack = remoteEmploymentService.getAllTrack();
        List<String> notFoundStudentNames = allTrack.stream()
                .map(TeacherToEmploymentDto::getStudentName)
                .filter(studentName -> !StudentNames.contains(studentName))
                .collect(Collectors.toList());
    //快去跟踪记录你们
        String message = "请:"+notFoundStudentNames+"快去跟踪记录";
        WechatRobotUtil.sendTextMessage(message, new ArrayList());
    }
    /**
     * 每周5早上10点提醒相关班级统计当前班级的就业数据
     */
    public void ryEmploymentTaskSend3() {
        String message = "请老师请查看班级就业情况";
        WechatRobotUtil.sendTextMessage(message, new ArrayList());
    }

}
